# 不推荐的方式：频繁拼接
import time


start_time = time.time()
result = ""
for i in range(10000):
    result += str(i)  # 每次拼接都创建新字符串
end_time = time.time()
print(f"直接拼接耗时: {end_time - start_time:.4f}秒")

# 推荐的方式：使用列表join
start_time = time.time()
parts = []
for i in range(10000):
    parts.append(str(i))
result = "".join(parts)
end_time = time.time()
print(f"join方式耗时: {end_time - start_time:.4f}秒")




text = "abcdefgh"
print(f"text原始值: {text}")
text[0] ='A'
print(f"text修改之后的值={text}")
